From: Joey Hess Date: Tue, 9 May 2023 20:59:44 +0000 (-0400) Subject: include url in json output X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~40^2~203 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=2fdf0ae38dfd5fb6f7014aa7665405f89a6cc5d8;p=git-annex.git include url in json output The input field is consistently the url of the feed, which makes sense as that is the user input, but to differentiate multiple urls downloaded from a feed when using --json-progress -J, need the url that is being downloaded too. Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project --- diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs index 2901e7628f..79c3db2943 100644 --- a/Command/ImportFeed.hs +++ b/Command/ImportFeed.hs @@ -459,14 +459,18 @@ runDownload todownload url extension cache cv getter = do ) startUrlDownload :: TMVar Bool -> ToDownload -> URLString -> CommandPerform -> CommandStart -startUrlDownload cv todownload url a = starting "addurl" - (ActionItemOther (Just (UnquotedString url))) - (SeekInput [feedurl todownload]) - (a `onException` recordfailure) +startUrlDownload cv todownload url a = do + starting "addurl" + (ActionItemOther (Just (UnquotedString url))) + (SeekInput [feedurl todownload]) + (go `onException` recordfailure) where recordfailure = do void $ feedProblem url "download failed" liftIO $ atomically $ tryPutTMVar cv False + go = do + maybeAddJSONField "url" url + a defaultTemplate :: String defaultTemplate = "${feedtitle}/${itemtitle}${extension}"